package com.zian.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

@Getter
public enum IsDeletedEnum {

    NO(0,"未删除"),
    YES(1,"已删除");
    @JsonValue
    @EnumValue
    private final int code;
    private final String name;

    IsDeletedEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(int code) {
        for (IsDeletedEnum item : values()) {
            if (item.getCode() == code) {
                return item.getName();
            }
        }
        return null;
    }
}
